package codeComposition;
import java.util.*;
public class ImportElement extends ObjectElement{
	private String from;
	private static int id = 0;
	private ArrayList<String> im = new ArrayList<String>();
	public ImportElement(String from, String im){
		super(String.valueOf(id));
		this.from = from;
		this.im.add(im);
		id++;
	}
	public ImportElement(String im){
		super(String.valueOf(id));
		this.im.add(im);
	}
	public ImportElement(String from, String[] im){
		super(String.valueOf(id));
		this.from = from;
		for(String s:im){
			this.im.add(s);
		}
		id++;
	}
	
	public String toString(){
		String str = "";
		int i = 1;
		for(String s:this.im){
			str += s;
			if(i < this.im.size()){
				str += ", ";
			}
			i++;
		}
		if(this.from!=null){
			return "from " + from + " import " + str + "\n";
		}
		else return "import " + str + "\n";
	}
}
